package main
import (
	"fmt"
)


type Goods struct{
    Name string
    Price float64
}

type Brand struct{
    Name string
    Address string
}

type TV struct{
    Goods
    Brand
}
type TV2 struct{
    *Goods
    *Brand
}
func main(){
    // 嵌套匿名结构体，也可以在创建结构体变量（实例时）直接指定匿名结构体字段的值
    tv := TV { Goods{"电视机001",5000},Brand{"海尔","山东"},}
    tv2 := TV{
        Goods{
            Price :6000,
            Name : "电视机",
        },
        Brand{
            Address : "北京",
            Name : "夏普",
        },
    }
    
    fmt.Println("tv=",tv)
     fmt.Println("tv2=",tv2)
     tv4 :=TV2{&Goods{"tv4",7999,},&Brand{"创维","河南",},}
     tv3 :=TV2{
         &Goods{
             Name:"电视机003",
             Price:49989,
         },
		 &Brand{
             Address : "四川",
             Name : "长虹",
         },
     }
 
     fmt.Println("tv4",*tv4.Goods,*tv4.Brand)
     fmt.Println("tv3",tv3.Goods,*tv3.Brand) // tv3 &{电视机003 49989} {长虹 四川}
}